﻿using UnityEngine;
using System.Collections;
using DICE_GS;  

public class UnitEvolutionManager : MonoBehaviour {
	public MyUnitCard beforeUnitCard;
	public MyUnitCard afterUnitCard;

	public UILabel unitInvenMaxCount;
	public UILabel unitInvenCurCount;
	public UILabel unitEvolutionDesc;
	public UILabel requireCardCount;
	public UILabel requireCardName;

	public UILabel requireGoldAmount;


	// Use this for initialization
	void Start () {
		int prevLevel=0,level=0;
		UnitInfo currentUnitInfo = MyInfo.Instance.GetUnitInfoById(MyInfo.Instance.LastSelectedUnitDBID);
		if( currentUnitInfo != null )
		{
			level = currentUnitInfo.UnitLevel;
			prevLevel = level-1;
		}
		CUnitData tmpUnitData = CUnitDataManager.Instance.GetUnitData(MyInfo.Instance.LastSelectedUnitID);
		if( MyInfo.Instance.LastSelectedUnitID != 0 )
		{
			beforeUnitCard.SetCardInfo(0, currentUnitInfo);
			beforeUnitCard.gameObject.SetActive(true);
		}
		
		if( MyInfo.Instance.LastSelectedUnitDBIDs.Count > 0 )
		{

		}
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	void OnClickMainUnitSelect()
	{
		MyInfo.Instance.LastSeletedUnitSlot = 0;
		MyInfo.Instance.LastSelectedUnitDBID = 0;
		MyInfo.Instance.LastSelectedUnitID = 0;
		CSceneManager c = GameObject.FindObjectOfType(typeof(CSceneManager)) as CSceneManager;
		c.GoToUnitInvenScene();
	}
	
	void OnClickAddMaterialCard()
	{
		if( MyInfo.Instance.LastSelectedUnitID != 0 )
		{
			MyInfo.Instance.LastSelectedUnitIDs.Clear();
			MyInfo.Instance.LastSelectedUnitDBIDs.Clear();
			CSceneManager c = GameObject.FindObjectOfType(typeof(CSceneManager)) as CSceneManager;
			c.GoToSelectUnitScene();
		}
//		else
//		{
//			warningText.gameObject.SetActive(true);
//		}
	}

	void OnClickedOKButton()
	{

	}
}
